package com.jytc.framework.constants;

import java.util.Properties;

import com.jytc.framework.annotation.Config;
import com.jytc.framework.annotation.PropertiesConfigLoader;
import com.jytc.framework.annotation.PropertiesLoaded;

/**
 * @title:系统错误编号定义
 * @description:
 * 
 * @author: dongyuese
 * 
 */
@Config
@PropertiesConfigLoader(file = "result_config.properties", refreshTime = 60 * 60)
public class ResultConstants
{
	/**提交成功*/
	public static final int SUBMIT_RESULT_SUCCEED = 1;
	/**提交失败*/
	public static final int SUBMIT_RESULT_FAILED = 0;
	/**提交异常*/
	public static final int SUBMIT_RESULT_ERROR = -1;

	/**信息加载失败*/
	public static final int LOAD_ERROR = 1005;

	/**登录成功*/
	public static final int LOGIN_SUCCESS = 9000;
	/**登录失败,验证码不正确!*/
	public static final int LOGIN_CODE_FAILED = 9001;
	/**登录失败,密码不正确!*/
	public static final int LOGIN_INFO_FAILED = 9002;
	/**登录失败,系统错误!*/
	public static final int LOGIN_ERROR = 9009;

	/**查询成功*/
	public static final int QUERY_SUCCEED = 1000;
	/**查询失败*/
	public static final int QUERY_FAILED = 1001;
	/**查询异常*/
	public static final int QUERY_ERROR = 1002;

	/**创建成功*/
	public static final int CREATE_SUCCEED = 2000;
	/**创建失败*/
	public static final int CREATE_FAILED = 2001;
	/**创建异常*/
	public static final int CREATE_ERROR = 2002;

	/**插入成功*/
	public static final int INSERT_SUCCEED = 3000;
	/**插入失败*/
	public static final int INSERT_FAILED = 3001;
	/**插入异常*/
	public static final int INSERT_ERROR = 3002;

	/**编辑成功*/
	public static final int EDIT_SUCCEED = 4000;
	/**编辑失败*/
	public static final int EDIT_FAILED = 4001;
	/**编辑异常*/
	public static final int EDIT_ERROR = 4002;

	/**更新成功*/
	public static final int UPDATE_SUCCEED = 5000;
	/**更新失败*/
	public static final int UPDATE_FAILED = 5001;
	/**更新异常*/
	public static final int UPDATE_ERROR = 5001;
	/**更新密码失败*/
	public static final int UPDATE_PASSWORD_FAILED = 5003;
	/**更新密码成功*/
	public static final int UPDATE_PASSWORD_SUCCEED = 5004;

	/**删除成功*/
	public static final int DELETE_SUCCEED = 6000;
	/**删除失败*/
	public static final int DELETE_FAILED = 6001;
	/**删除异常*/
	public static final int DELETE_ERR0R = 6002;

	/**查看成功*/
	public static final int VIEW_SUCCESS = 7000;
	/**查看失败*/
	public static final int VIEW_FAILED = 7001;
	/**查看异常*/
	public static final int VIEW_ERR0R = 7002;

	/**审核成功*/
	public static final int AUDIT_SUCCEED = 8000;
	/**审核失败*/
	public static final int AUDIT_FAILED = 8001;
	/**审核异常*/
	public static final int AUDIT_ERROR = 8002;

	private static Properties resultProperties;

	/**
	 * 根据错误编号获得错误信息
	 * 
	 * @param resultCode
	 * @return
	 */
	public static String getResultInfo(int resultCode)
	{
		return resultProperties.getProperty(String.valueOf(resultCode));
	}

	@PropertiesLoaded
	public static void setResultProperties(Properties resultProperties)
	{
		ResultConstants.resultProperties = resultProperties;
	}
}
